package com.pic.mgt.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class Log {
	private Logger logger;
	
	public Log(String loggerName) {
		this.logger = LoggerFactory.getLogger(loggerName);
	}
	
	public void error(Object logObj, String string) {
		logger.error(concatLogClassNameToMessage(logObj, string));
	}
	
	public void error(Object logObj, String string, Object arg1) {
		logger.error(concatLogClassNameToMessage(logObj, string),
					 arg1);
	}
	
	public void error(Object logObj, String string, Object ... args) {
		logger.error(concatLogClassNameToMessage(logObj, string),
					 args);
	}
	
	public void warn(Object logObj, String string) {
		logger.warn(concatLogClassNameToMessage(logObj, string));
	}
	
	public void warn(Object logObj, String string, Object arg1) {
		logger.warn(concatLogClassNameToMessage(logObj, string),
					arg1);
	}
	
	public void warn(Object logObj, String string, Object ... args) {
		logger.warn(concatLogClassNameToMessage(logObj, string),
					args);
	}
	
	public void info(Object logObj, String string) {
		logger.info(concatLogClassNameToMessage(logObj, string));
	}
	
	public void info(Object logObj, String string, Object arg1) {
		logger.info(concatLogClassNameToMessage(logObj, string),
					arg1);
	}
	
	public void info(Object logObj, String string, Object ... args) {
		logger.info(concatLogClassNameToMessage(logObj, string),
					args);
	}
	
	public void debug(Object logObj, String string) {
		logger.debug(concatLogClassNameToMessage(logObj, string));
	}
	
	public void debug(Object logObj, String string, Object arg1) {
		logger.debug(concatLogClassNameToMessage(logObj, string),
					 arg1);
	}
	
	public void debug(Object logObj, String string, Object ... args) {
		logger.debug(concatLogClassNameToMessage(logObj, string),
					 args);
	}
	
	public void trace(Object logObj, String string) {
		logger.trace(concatLogClassNameToMessage(logObj, string));
	}
	
	public void trace(Object logObj, String string, Object arg1) {
		logger.trace(concatLogClassNameToMessage(logObj, string),
					 arg1);
	}
	
	public void trace(Object logObj, String string, Object ... args) {
		logger.trace(concatLogClassNameToMessage(logObj, string),
					 args);
	}
	
	private String concatLogClassNameToMessage(Object logObj, String string) {
		return logObj.getClass().getSimpleName() + " - " + string;
	}
	
	public boolean isErrorMode() {
		return logger.isErrorEnabled();
	}
	
	public boolean isWarnMode() {
		return logger.isWarnEnabled();
	}
	
	public boolean isInfoMode() {
		return logger.isInfoEnabled();
	}
	
	public boolean isDebugMode() {
		return logger.isDebugEnabled();
	}
	
	public boolean isTraceMode() {
		return logger.isTraceEnabled();
	}
	
	// --- getter and setter ---
	
	public void setLoggerName(String loggerName) {
		this.logger = LoggerFactory.getLogger(loggerName.trim());
	}
	
}
